package com.zj.core.activity

import android.os.Bundle
import android.view.View
import android.widget.LinearLayout
import android.widget.MediaController
import com.quitutils.SwipeBackLayout
import com.zj.core.base.TitleBarActivity
import com.zj.core.bean.VideoMesBean
import com.zj.core.ui.VideoPlayUi
import org.jetbrains.anko.setContentView

class VideoPlayActivity: TitleBarActivity(){
    lateinit var mVideoUi: VideoPlayUi

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setQuitMode(SwipeBackLayout.EDGE_LEFT)
    }

    override fun onCreate(groupView: LinearLayout): View? {
        mVideoUi= VideoPlayUi(groupView)
        return mVideoUi.setContentView(this)
    }

    override fun initView() {
        val videoData=intent.getSerializableExtra("video") as VideoMesBean.DatEntity.RowsEntity
        setTitleText(videoData.title.toString())

        with(mVideoUi){
            this.videoView.setVideoPath(videoData.video)
            this.videoView.setMediaController(MediaController(this@VideoPlayActivity))
            this.videoView.requestFocus()
        }
    }
}